import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'gradient_button.dart';
import 'ink_widget.dart';

/// todo: 当前项目的弹出框
void showDialogGetx({
  String? title,
  String? subTitle,
  String? btnText,
  bool rowBtn=false,
  Function? okTap,
  String? cancelText,
  String? okText,
  bool popHand=false,
  bool inkScreen=false,
}) {
  Get.dialog(
    WillPopScope(child: Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      mainAxisAlignment: MainAxisAlignment.center,
      children : [
        Padding(
          padding: EdgeInsets.all(40),
          child: Material(
            child: ClipRRect(
              child: Container(
                color: Colors.white,
                padding: EdgeInsets.all(15),
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    rowBtn? SizedBox(): Row(
                      children: [
                        InkWidget.imgAsset("rem.png",width: 30,onTap: (){
                          Get.back();
                        }),
                      ],
                      mainAxisAlignment: MainAxisAlignment.end,
                    ),
                    InkWidget.title("${title ?? '系统提示'}",fonSize: 18),
                    InkWidget.text("\n$subTitle\n"),
                    rowBtn ? Row(
                      mainAxisAlignment: MainAxisAlignment.spaceAround,
                      children: [
                        SizedBox(
                          child: gradientButton("${cancelText ?? '取消'}",circular: 40,onTap: (){
                            Get.back();
                          }),
                        ),
                        SizedBox(
                          child: gradientButton("${cancelText ?? '确认'}",circular: 40,onTap: (){
                            if(okTap != null)  okTap();
                          }),
                        )
                      ],
                    ):SizedBox(
                      width: Get.width,
                      child: gradientButton("$btnText",circular: 40,onTap: (){
                        if(okTap != null)  okTap();
                      }),
                    )
                  ],
                ),
              ),
              borderRadius: BorderRadius.circular(10),
            ),
            color: Colors.transparent,
          ),
        ),
      ],
    ), onWillPop: () async=>popHand),
    barrierDismissible: inkScreen,
  );
}